package com.aaa.project4;

public class K {
    public static void sort(int [] arr){
        for (int i = 1; i < arr.length ; i++) {
            for (int j = 0; j <arr.length-1 ; j++) {
                if (arr[j]>arr[j+1]) {
                    int temp = arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=temp;
                }
            }
        }
    }
    public static int Max(int [] arr){
        int temp =arr[0];
        for (int i = 0; i < arr.length ; i++) {
            if (temp <arr[i]) {
                temp=arr[i];
            }
        }
        return temp;
    }
    public static  int indexOf(int [] arr,int a){
        for (int i = 0; i < arr.length ; i++) {
            if (a == arr[i]) {
                return i;
            }
        }
        return -1;
    }
    public static String pingjie (int [] arr){
        String str="[";
        for (int i = 0; i < arr.length ; i++) {
            str+=arr[i];
            if (i< arr.length-1) {
                str+=",";
            }else {
                str+="]";
            }
        }
        return str;
    }
    public static String yizhi(int [] arr ,int[] arr1){
        if (arr.length != arr1.length) {
            return "不一致";
        }
        for (int i = 0; i < arr.length ; i++) {
            if (arr[i]!=arr1[i]) {
                return "不一致";
            }
        }
        return "一致";
    }
}
